import java.util.Arrays;
import java.util.Scanner;
class ArrayUtils{
	static class PairResult{
		private double min ;
		private double max ;
		public PairResult(double min, double max) {
			this.min = min;
			this.max = max;
		}
		public String toString() {
			return "PairResult [min=" + min + ", max=" + max + "]";
		}
	}
	public static PairResult findMinMax(double [] values){
		double minNumber = 0;
		double maxNumber = 0 ;
		for (int i = 0; i < values.length; i++) {
			if(i == 0)
			{
				minNumber = values[i] ;
				maxNumber = values[i] ;
				continue ;
			}
			if(values[i] > maxNumber){
				maxNumber = values[i] ;
				continue ;
			}
			if(values[i] < minNumber){
				minNumber = values[i] ;
				continue ;
			}
		}
		return new PairResult(minNumber,maxNumber) ;
	}
}
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner (System.in) ;
		double arr[] = new double[sc.nextInt()] ;
		for (int i = 0; i < arr.length; i++) {
			arr[i] = sc.nextDouble() ;
		}
		System.out.println(ArrayUtils.findMinMax(arr));
		System.out.println(ArrayUtils.PairResult.class);
	}
}